package com.rinlink.jbcodec.transform;

import com.alibaba.fastjson.JSONObject;
import com.rinlink.jbcodec.BytesToObjectCreatorMap;
import com.rinlink.jbcodec.JSONCodec;

import java.nio.ByteBuffer;

public class BytesToJSONList extends BytesToList<JSONObject> {

    private JSONCodec.Scheme scheme;
    private BytesToObjectCreatorMap creatorMap;

    public BytesToJSONList(
            ByteBuffer byteBuffer,
            int listSize,
            JSONCodec.Scheme scheme,
            BytesToObjectCreatorMap creatorMap) {
        super(byteBuffer, listSize);
        this.scheme = scheme;
        this.creatorMap = creatorMap;
    }

    @Override
    protected JSONObject transform(ByteBuffer buffer) {
        return new BytesToJSON(buffer,scheme,creatorMap).transform();
    }
}
